package com.ct.gd.passport.common.mock;

import java.util.Iterator;
import java.util.List;

import org.apache.http.NameValuePair;

import com.up91.common.android.connect.Params;
import com.up91.common.android.connect.ParamsPair;

public class RequestAdapter extends ConnectRequest{

	Params params;
	
	public RequestAdapter(String url,Params ps){
		this.url = url;
		params = ps;
	}
	
	@Override
	public String getContent() {
		return params.toString();
	}
	
	public void addParams(String key, String value){
		params.put(key, value);
	}
	
	@Override
	public List<? extends NameValuePair> getParams() {
		content.clear();
		Iterator<ParamsPair<String, ?>> iterators= params.iterator();
		while(iterators.hasNext()){
			ParamsPair<String, ?> element = iterators.next();
			super.addParams(element.getName(),element.getValue());
//			content.add(new BasicNameValuePair(element.first,(String)element.second));
		}
		return content;
//		return params;
	}
	
}
